www.gusucode.com > 茶都拼客网全功能版 8 > 茶都拼客网全功能版 8.8源码程序/teasdxmccom/茶都拼客网V8.8(全功能,无限制,完全开源)/admin/Vote/Ku_conn.asp

    <%
    dim conn
    dim connstr
    dim db
    db="../../"&""&Ku_database&"" '设定数据名称,建议改成.asa
    dim dbset:setdb = 1	 '设定连接类型
    On error resume next
    Set conn = Server.CreateObject("ADODB.Connection")
	select case setdb
	case "1"
    connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")
	case "2"
 	connstr="driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath(""&db&"")
	case "3"
 	connstr="driver={SQL Server};server=localhost;UID=sa;PWD=123;database=GaoBei_Sys_data"
	case else
	connstr= "Dns=GaoBei_Sys_data"
	end select
	if err.number>0 then 
		err.clear
		set conn=nothing
		response.write "数据库连接出错!"
		Response.End
	else
		conn.open connstr
		if err then 
			err.clear
			set conn=nothing
			response.write "数据库连接出错!"
			Response.End 
		end if
	end if
    Sub CloseConn()
	conn.close
	set conn=nothing
    End sub
    
function strtext(str)
    strtext=replace(str,chr(34),"&quot;")
end function

function strSql(str)
    strSql=replace(str,"'","''")
end function

function flashSql(str)
    flashSql=replace(str,"chr(124)","|")
end function

function intSql(Numeric)
    if IsNumeric(Numeric) then
        intSql=Numeric
    else
        intSql=0
    end if
end function

function inthit(Numeric)
	If(Numeric="") Then
		inthit=1
	else
	    if IsNumeric(Numeric) and Numeric>=1 then
		inthit=Numeric
	    else
		inthit=1
	    end if
	End if
end function
%>